.\" -*-nroff-*-
.TH "GOSH" "1" "" "Gauche @GAUCHE_VERSION@" "Gauche Commands"
.SH NAME
gosh \- a Scheme script interpreter
.SH SYNOPSIS
.B gosh
[-biqV]
[-I
.I path
]
[-A
.I path
]
[-u
.I module
]
[-l
.I file
]
[-L
.I file
]
[-e
.I expr
]
[-E
.I expr
]
[-m
.I module
]
[-f
.I flag
]
[-F
.I feature
]
[-p
.I type
]
[-r
.I standard
]
[--]
[
.I script argument ...
]
.br
.sp 0.3
.SH DESCRIPTION
.I Gosh
is a stand-alone Scheme interpreter built on top of the
.I Gauche
Scheme script engine.

When
.I script
is given, gosh loads the script, evaluating Scheme code in it.
Then, if the
.I script
defines a procedure named
.I main,
gosh calls it with a single argument which is a list of
the script name and subsequent arguments.
When
.I main
returns an integer value, gosh exits with it as an exit code.
If
.I main
returns non-integer value, or an error is signaled during
evaluation, gosh exits with exit code 70 (EX_SOFTWARE).
See SRFI-22 (http://srfi.schemers.org/srfi-22/srfi-22.html) for
details.
If there's no
.I main
procedure defined in the script, gosh exits with code 0
after loading the script file.

If no script file is given, gosh goes into an interactive mode.
By default, gosh prompts the user to enter a Scheme expression,
read and evaluates it, then prints the result, until EOF is read.
If the standard input is not a terminal, however, gosh doesn't
print a prompt; it allows a user to use gosh as a filter program.
This behavior can be controlled by -i or -b option; see below.

.SH OPTIONS
Command line options are processed before loading the script file
or entering the interactive mode.

The options -I, -A, -u, -l, -L, -e and -E are processed in the order
of appearance.  For example, adding a load path by -I option
affects the -l options after it, but not the ones before it.

.TP 5
.BI -V
Prints gosh version and exits.
.TP
.BI -b
Batch mode.  Doesn't print prompt even the standard input
is a terminal.  Supersedes -i.
.TP
.BI -i
Interactive mode.  Forces to print prompt, even the standard input
is not a terminal.
.TP
.BI -q
Prevents reading the default initialization file.
.TP
.BI -I path
Adds
.I path
in front of the load path list.
.TP
.BI -A path
Appends
.I path
to the tail of the load path list.
.TP
.BI -u module
Loads and imports
.I module,
as if "(use
.I module
)" is specified in the code.
.TP
.BI -l file
Loads a Scheme file
.I file.
.TP
.BI -L file
Like -l, but doesn't complain if
.I file
doesn't exist.
.TP
.BI -e expr
Evaluates a Scheme expression
.I expr.
.TP
.BI -E expr
Same as -e, except that the
.I expr
is read as if it is surrounded by parenthesis.
.TP
.BI -p type
Turns on the profiler.
.I Type
can be either 'time' or 'load'.
.TP
.BI -m module
When the script file is given, this option specifies the name of
the module in which the "main" procedure is defined.
The default is "user".
.TP
.BI -r standard
Starts gosh with the default environment defined
in RnRS, where n is determined by
.I standard.
Currently, only 7 is the valid value of
.I standard.
.TP
.BI -f flag
Sets various flags.
  case-fold       use case-insensitive reader (as in R5RS)
  load-verbose    report while loading files
  include-verbose report while including files
  no-inline       don't inline primitive procedures and constants
                  (combined no-inline-globals, no-inline-locals,
                  no-inline-constants and no-inline-setters.)
  no-inline-globals don't inline global procedures.
  no-inline-locals  don't inline local procedures.
  no-inline-constants don't inline constants.
  no-inline-setters don't inline setters.
  no-post-inline-pass don't run post-inline optimization pass.
  no-lambda-lifting-pass don't run lambda lifting optimization pass.
  no-source-info  don't retain source information.
  warn-legacy-syntax print warning when legacy Gauche syntax
                  is encountered.
  test            assume being run in the build tree; tries to
                  load files from the current build instead of
                  installation directories.  Useful to test
                  the build without installation.
.TP
.BI -F feature
Makes
.I feature
available in cond-expand forms.
.TP
.BI --
Specifies that there are no more options.  If there are more
arguments after this, they are taken as script file name and
its arguments.

.SH ENVIRONMENT
.TP
.B GAUCHE_LOAD_PATH
.TQ
A colon separated list of the load paths.
The paths are appended before the system default load paths.
.TP
.B GAUCHE_DYNLOAD_PATH
.TQ
A colon separated list of the load paths for dynamically loaded
objects.
The paths are appended before the system default load paths.

.SH AUTHORS
Shiro Kawai (shiro @ acm . org)

.SH SEE ALSO
gauche-config(1)
.PP
Gauche Scheme script engine:
.br
https://practical-scheme.net/gauche/
.PP
For the information about Scheme language, see
.br
https://www.schemers.org/

